﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="giftorders.aspx.cs" Inherits="giftorders" EnableViewState="false" %>
<!DOCTYPE html>
<html>
<head>
    <title>礼品订单</title>
</head>
<body>
    <div>
        <section data-role="page" id="giftorders_main">
            <div style="padding:0px;" id="giftorders_content">
                <!--订单信息-->
                <ul data-role="listview" id="giftsordersinfo" runat="server">
               	    <li data-role="list-divider" style="background:#09f;">填写并审核订单信息</li>

                    <li style="padding:0px;">
                        <div class="meminfo">
                            <fieldset>
                                <label for="memname">姓名</label>
                                <input type="text" id="memname" placeholder="请输入您的姓名" />
                                <label for="telnumber">手机号码</label>
                                <input type="text" id="telnumber" placeholder="请输入您的手机号码" />
                                <label for="address">地址</label>
                                <textarea class="address" id="address" placeholder="请输入您的收货地址" style="height:100px;font-size:13px;"></textarea>
                            </fieldset>
                        </div>
                    </li>
                </ul>

                
                <!--礼品清单-->
                <ul data-role="listview" id="giftsinventory">
                    <li data-role="list-divider" style="background:#09f;">礼品清单</li>

                    <li style="padding:10px; background:#fff;">
                        <div class="detail-main"  style="padding:0px;">
                           <asp:Repeater runat="server" ID="rptGiftsinventory">
                                <ItemTemplate>
                                     <!--Repeater Start-->
                                    <div class="detail_row" style="border-bottom:1px dashed #cdcdcd;">
                	                    <!--left-->
                                        <div class="row_item row_item-left">
                                            <img src="<%#Eval("GiftPhoto") %>"   onerror="javascript:this.src='../images/Gift/nogift.jpg'"  />
                                        </div>
                                        <!--right-->
                                        <div class="row_item row_item-right">
                                            <strong style="font-size:14px;"><%#Eval("GiftName") %></strong>
                                            <span style="margin-top:5px;display:block;">单个积分：<span class="discountPrice"><%#Eval("GiftExchangePoint") %></span></span>
                                            <span style="display:block;">购买数量：<%#Eval("ConvertNumber") %></span>
                                            <span style="display:block;">小计积分：<span class="discountPrice"><%#Eval("Subtotal") %></span></span>
                                        </div>
                                        <!--right end-->
                                    </div>
                                 
                                    <!--Repeater End-->
                                </ItemTemplate>
                           </asp:Repeater> <br/>
                            <span id="total" style="font-size:17px;"><span id="spTotalPointDesc" runat="server">应付总积分</span>：<span id="totalPoint" runat="server"></span></span>
                        </div>
                    </li>
                </ul>
                <a href="#" data-role="button" data-theme="a" id="aGiftOrderSubmit" runat="server" style="background:#09f; border:0px;margin:10px; border-radius:8px;">提交订单</a>

                <a href="#index" data-role="button" data-theme="b" style="display:none;" id="goBack">返回首页</a>
       
            </div>

            <div style="width:100%; height:50px;"></div>
            
            <script type="text/javascript">
                $("#aGiftOrderSubmit").click(function () {
                    var memname = $.trim($("#memname").val());
                    var telnumber = $.trim($("#telnumber").val());
                    var address = $.trim($("#address").val());
                    if (memname == "") { alert("请输入您的姓名!"); return; }
                    if (telnumber == "") { alert("请输入您的手机号码!"); return; } else { if (!telnumber.IsMobile()) { alert("您输入的手机号码格式有误"); return; } }
                    if (address == "") { alert("请输入您的收货地址!"); return; }
                    $.get("../Service/AjaxService.ashx?Method=GiftApplication",
                    {
                        "MemID": getCookie("uid"),
                        "MemName": memname,
                        "ExchangeTelePhone": telnumber,
                        "ExchangeAddress": address,
                        "ExchangeAllPoint": $("#totalPoint").text()
                    }
                    , function (text) {
                        if (text == "0") { alert("系统有点繁忙，提交失败！"); } else {
                                alert("申请成功!");
                                //清空localStorage对象
                                var strKey = "";
                                var getData = "";
                                for (var i = localStorage.length - 1; i >= 0; i--) {
                                    strKey = localStorage.key(i);
                                    if (strKey.substring(0, 5) == "gift_") {
                                        getData = JSON.parse(xxl.xd.getValue(strKey));
                                        localStorage.removeItem(getData.Type);
                                    }
                                }
                                //清空Cookie
                                setCookie("giftlist", "");
                            }
                            $("#goBack").click();
                    }, "text")
                })
            </script>

     

            <footer data-role="footer" data-position="fixed" id="giftorders_footer">
                <div data-role="navbar" id="nav-glyphish-example">
                    <ul>
                        <li><a href="#index" id="site" ><img src="images/business_site_btn.png" /><br/>商家网站</a></li>
                        <li><a href="#" onclick="openshoplist()"><img src="images/Goods_Book_btn.png" /><br/>商品购买</a></li>
                        <li><a href="#membershipcard" data-load="membershipcard.aspx" id="card" runat="server"><img src="images/member_card_btn.png" /><br/>会员卡</a></li>
                        <li class="footer_active"><a href="#giftlist" data-load="giftlist.aspx" id="convert" runat="server"><img src="images/04.png" /><br/>积分兑换</a></li>
                    </ul>
                </div>
            </footer>
        </section>
    </div>
</body>
</html>

